#include<iostream>
using namespace std;
int main(){
	 int s=0,x,n,i,k;
	  cin>>x;
   while(x!=0){
   	  k=x;
      while(k!=0){
        s+=k%10;
        k/=10;
     } 
     x--;
   } 
cout<<s<<endl;
return 0;
}
